using Senparc.Weixin.Entities;
using Senparc.Weixin.MP.CommonAPIs;
using System;
namespace Senparc.Weixin.MP.AdvancedAPIs.MerChant
{
	public static class GroupApi
	{
		public static AddGroupResult AddGroup(string accessToken, AddGroupData addGroupData)
		{
			string urlFormat = "https://api.weixin.qq.com/merchant/group/add?access_token={0}";
			return CommonJsonSend.Send<AddGroupResult>(accessToken, urlFormat, addGroupData, CommonJsonSendType.POST, 10000, false);
		}
		public static WxJsonResult DeleteGroup(string accessToken, int groupId)
		{
			string urlFormat = "https://api.weixin.qq.com/merchant/group/del?access_token={0}";
			var data = new
			{
				group_id = groupId
			};
			return CommonJsonSend.Send<WxJsonResult>(accessToken, urlFormat, data, CommonJsonSendType.POST, 10000, false);
		}
		public static WxJsonResult PropertyModGroup(string accessToken, PropertyModGroup propertyModGroup)
		{
			string urlFormat = "https://api.weixin.qq.com/merchant/group/propertymod?access_token={0}";
			return CommonJsonSend.Send<WxJsonResult>(accessToken, urlFormat, propertyModGroup, CommonJsonSendType.POST, 10000, false);
		}
		public static WxJsonResult ProductModGroup(string accessToken, ProductModGroup productModGroup)
		{
			string urlFormat = "https://api.weixin.qq.com/merchant/group/productmod?access_token={0}";
			return CommonJsonSend.Send<WxJsonResult>(accessToken, urlFormat, productModGroup, CommonJsonSendType.POST, 10000, false);
		}
		public static GetAllGroup GetAllGroup(string accessToken)
		{
			string urlFormat = "https://api.weixin.qq.com/merchant/group/getall?access_token={0}";
			return CommonJsonSend.Send<GetAllGroup>(accessToken, urlFormat, null, CommonJsonSendType.GET, 10000, false);
		}
		public static GetByIdGroup GetByIdGroup(string accessToken, int groupId)
		{
			string urlFormat = "https://api.weixin.qq.com/merchant/group/getbyid?access_token={0}";
			var data = new
			{
				group_id = groupId
			};
			return CommonJsonSend.Send<GetByIdGroup>(accessToken, urlFormat, data, CommonJsonSendType.POST, 10000, false);
		}
	}
}
